/*
 * @Author: xiaosihan 
 * @Date: 2023-08-07 21:13:42 
 * @Last Modified by: xiaosihan
 * @Last Modified time: 2024-05-05 16:09:08
 */



import preview3DRenderer from "@/editorComponent/preview3DRenderer";
import { VerticalAlignBottomOutlined } from "@ant-design/icons";
import { Tooltip } from "antd";
import { autorun } from "mobx";
import { useEffect } from "react";
import styles from "./preview3D.module.less";
import clsx from "clsx";

interface Iprops {
  show: boolean;
}

// 3d 预览
export default function Preview3D(props: Iprops) {
  useEffect(() => {

  }, []);

  useEffect(() => autorun(() => {

  }), []);

  return (
    <div
      className={clsx(styles.preview3D, props.show && styles.show)}
    >
      <canvas
        className={styles.canvas}
        width={280 * 4}
        height={280 * 4}
        ref={dom => preview3DRenderer.addPreviewCanvas(dom)}
      />

      <Tooltip
        placement="top"
        title="保存效果图"
      >
        <VerticalAlignBottomOutlined
          className={styles.saveThumb}
          onClick={() => preview3DRenderer.download()}
        />
      </Tooltip>

    </div>
  );

}